package com.zjitc.config;


import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.context.annotation.Bean;

import javax.sql.DataSource;

/**
 * @Author luqi
 * @Date 2025 06 19 10 17
 **/

public class MybatisConfig {

    @Bean
    public SqlSessionFactoryBean sqlSessionFactoryBean(DataSource dataSource){
        SqlSessionFactoryBean SSFBean = new SqlSessionFactoryBean();
        SSFBean.setTypeAliasesPackage("com.zjitc.pojo");
        SSFBean.setDataSource(dataSource);

        return SSFBean;
    }

    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer(){
        MapperScannerConfigurer MSC = new MapperScannerConfigurer();
        MSC.setBasePackage("com.zjitc.mapper");
        return MSC;
    }
}
